/**
 * 此文件实现的是textarea的自适应高度
 *
 */

let $textArea = $('textarea');
$textArea.css({
    'min-height': '50px'
});

/*
$textArea.on('input', function (e){
    console.log($textArea.target);
    $textArea.style.height = $textArea.target.scrollHeight + "px";
    console.log($textArea.target.scrollHeight + "px");

})*/


let textarea = document.querySelector('#test');

textarea.addEventListener('input', (e) => {
    if(textarea.style.minHeight <= e.target.scrollHeight){
        textarea.style.height = e.target.scrollHeight + 'px';
    }
});